Ext.define('Era.view.PreviewScreen',{
    extend: 'Ext.container.Container',
    alias: 'widget.previewscreen',
    layout: 'vbox',
    
    style: {
        padding: '15px'
    },
    
    
    initComponent: function() {
        
        this.items = [];
        
        this.items.push({
            xtype: 'label',
            cls: 'preview_title',
            text: this.record.get('title')
        });
        
        this.items.push ({
            xtype: 'label',
            cls: 'preview_description_label',
            text: 'Description:'
        });
        
        this.items.push ({
            xtype: 'label',
            cls: 'preview_description',
            text: this.record.get('description')
        });
   
        var time = '';
        if (this.record.get('start_date') != null && this.record.get('start_date') != 'undefined') {
            var st = this.record.get('start_date');
            time += 'From: ' + st.getDate() + '-' + (st.getMonth() + 1) + '-' + st.getFullYear();
            
        }
        
        if (this.record.get('end_date') != null && this.record.get('end_date') != 'undefined') {
            var ed = this.record.get('end_date');
            time += 'To: ' + ed.getDate() + '-' + (ed.getMonth() + 1) + '-' + ed.getFullYear() + ' ';
        }
        
        if (time != '') {
            this.items.push ({
                xtype: 'label',
                cls: 'preview_start',
                text: time
            });
        }
        
        if (this.record.get('priority') == 1) {
            this.items.push ({
                xtype: 'label',
                cls: 'preview_priority',
                text: 'HIGH PRIORITY EVENT!'
            });
        }
        
        this.callParent(this);
    },
    
    getTMinus: function(time) {
        return '3h';
    }
    
});

